package com.realbrand.net.realbrandpay.ui.activity.wallet.order;

import com.realbrand.net.realbrandpay.base.BasePersenter;
import com.realbrand.net.realbrandpay.bean.OrderBean;

/**
 * Created by Administrator on 2018/5/18.
 */

public class PersenterOrder extends BasePersenter<IViewOrder> {
    //获取部分订单
    public void getOrderInfoData(String param) {
        if (!isViewAttched()){
            return;
        }
        getView().showLoading();
        ModelOrder.getOrderInfo(param, new IModelOrder<OrderBean>() {
            @Override
            public void onSuccess(OrderBean data) {
                if (isViewAttched()){
                    getView().OrderInfoData(data);
                }
            }

            @Override
            public void onFail(String msg) {
                if (isViewAttched()){
                    getView().showFailMsg(msg);
                }
            }

            @Override
            public void onErrorr() {
                if (isViewAttched()){
                    getView().showError();
                }
            }

            @Override
            public void onComplete() {
                    if (isViewAttched()){
                        getView().hideLoading();
                    }
            }
        });
    }
    //获取全部订单
    public void getAllOrderInfoData(String param) {
        if (!isViewAttched()){
            return;
        }
        getView().showLoading();
        ModelOrder.getAllOrderInfo(param, new IModelOrder<OrderBean>() {
            @Override
            public void onSuccess(OrderBean data) {
                if (isViewAttched()){
                    getView().OrderInfoData(data);
                }
            }

            @Override
            public void onFail(String msg) {
                if (isViewAttched()){
                    getView().showFailMsg(msg);
                }
            }

            @Override
            public void onErrorr() {
                if (isViewAttched()){
                    getView().showError();
                }
            }

            @Override
            public void onComplete() {
                if (isViewAttched()){
                    getView().hideLoading();
                }
            }
        });
    }
}
